package com.kingmed.kmss.admin.modules.sys.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kingmed.kmss.admin.modules.sys.mapper.SysMsgMapper;
import com.kingmed.kmss.admin.modules.sys.model.SysMsg;
import com.kingmed.kmss.admin.modules.sys.service.SysMsgService;
import com.kingmed.kmss.common.dto.admin.sys.SysMsgDTO;

import javax.validation.Valid;

import org.springframework.stereotype.Service;

/**
 * <p>
 * 系统消息表 服务实现类
 * </p>
 *
 * @author lilin
 * @since 2023-01-05
 */
@Service
public class SysMsgServiceImpl extends ServiceImpl<SysMsgMapper, SysMsg> implements SysMsgService {

	@Override
	public void markAsReadForBusiness(@Valid SysMsgDTO sysMsgDTO) {
		SysMsg msg = new SysMsg();
		msg.setBizType(sysMsgDTO.getBizType());
		msg.setBusinessId(sysMsgDTO.getBusinessId());
		msg.setMsgType(sysMsgDTO.getMsgType());
		msg.setReceiveById(sysMsgDTO.getReceiveById());
		
		getBaseMapper().markMsgAsReadForBusiness(msg);
	}

}
